﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FJASPX.Framwork.Dao;
using FJASPX.Domain;
using FJASPX.Framwork.Query;
using NHibernate.Criterion;

namespace FJASPX.Service.Implement
{
    /// <summary>
    /// 行业类别服务
    /// </summary>
    public class ProductCategoryService : NHEntityDao<ProductCategory>, IProductCategoryService
    {

        public Page PagedQuery(DetachedCriteria detachedCriteria, int startIndex, int pageSize, List<Order> orders)
        {
            CriteriaQueryTemplate qt = new DomainCriteriaQueryTemplate(SessionFactory);
            return qt.PagedQuery(detachedCriteria, startIndex, pageSize, orders);
        }

        public int GetRowCount(DetachedCriteria detachedCriteria)
        {
            CriteriaQueryTemplate qt = new DomainCriteriaQueryTemplate(SessionFactory);
            return qt.RowCountQuery(detachedCriteria);
        }

        public IList<ProductCategory> GetAll(string orderBy)
        {
            string hql = "from ProductCategory where 1=1 " + orderBy;
            return this.HibernateTemplate.Find<ProductCategory>(hql);
        }
        public IList<ProductCategory> PagedQuery(ICriterion expression, List<Order> order, int pageIndex, int pageSize, out long recordCount)
        {
            return this.Query<ProductCategory>(expression, order, pageIndex, pageSize, out recordCount);
        }
        public IList<ProductCategory > PagedQuery(List<ICriterion> expressions, List<Order> order, int pageIndex, int pageSize, out long recordCount)
        {
            return this.Query< ProductCategory>(expressions, order, pageIndex, pageSize, out recordCount);
        }
    }
}
